<?php
require 'functions.php';

if ($_GET['logout']==1) {
	logout();
}

$user = $_POST['user'];
$pwd = $_POST['password'];

login($user, $pwd);
if (is_login()) {
    echo "<script>location.href='main.php'</script>";
}

?>
<form action="login.php" method="post">
	<table style="margin:0px auto">
	<tr>
		<td style="text-align:right">USER</td>
                <td>
                        <input name="user" />
                </td>
        </tr>
        <tr>
                <td style="text-align:right">PASSWORD</td>
                <td>
                       <input name="password" type="password" />
                </td>
        </tr>
        <tr><td></td><td><input type="submit" value="login"/></td></tr>

        </table>
</form>
